package cn.christ.com.mobilesafe.view.widgets;

import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.christ.com.mobilesafe.R;
import cn.christ.com.mobilesafe.common.Global;

/**
 * Created by Administrator on 2018/7/23.
 */

public class Text2View extends LinearLayout {
    @BindView(R.id.tv1)
    TextView tv1;
    @BindView(R.id.tv2)
    TextView tv2;

    public Text2View(Context context) {
        super(context);
    }

    public Text2View(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        View inflate = Global.inflate(R.layout.view_text);
        ButterKnife.bind(this, inflate);
        this.addView(inflate);

        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.Text2View);
        String left = typedArray.getString(R.styleable.Text2View_left);
        String right = typedArray.getString(R.styleable.Text2View_right);

        tv1.setText(left);
        tv2.setText(right);

        typedArray.recycle();

    }
}
